@use './variables.scss' as *;

// 全局重置样式
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: $font-size-base;
  line-height: $line-height-normal;
  color: $text-primary;
  background-color: $background-color-base;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

#app {
  height: 100%;
}

// 链接样式
a {
  color: $primary-color;
  text-decoration: none;
  transition: all $transition-base $ease-in-out;
  
  &:hover {
    color: $primary-dark;
    transform: translateY(-1px);
  }
}

// 按钮样式重置
button {
  border: none;
  outline: none;
  cursor: pointer;
  background: none;
  font-family: inherit;
  transition: all $transition-base $ease-in-out;
}

// 输入框样式重置
input, textarea {
  border: none;
  outline: none;
  font-family: inherit;
  transition: all $transition-base $ease-in-out;
}

// 列表样式重置
ul, ol {
  list-style: none;
}

// 图片样式
img {
  max-width: 100%;
  height: auto;
  border-radius: $border-radius-base;
}

// 表格样式重置
table {
  border-collapse: collapse;
  border-spacing: 0;
}

// 滚动条样式
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: $background-color-light;
  border-radius: $border-radius-base;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, $primary-color, $primary-light);
  border-radius: $border-radius-base;
  
  &:hover {
    background: linear-gradient(180deg, $primary-dark, $primary-color);
  }
}

// 选择文本样式
::selection {
  background: rgba($primary-color, 0.2);
  color: $text-primary;
}

// 工具类
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.m-0 {
  margin: 0;
}

.p-0 {
  padding: 0;
}

// 间距工具类
.mt-1 { margin-top: $spacing-xs; }
.mt-2 { margin-top: $spacing-sm; }
.mt-3 { margin-top: $spacing-md; }
.mt-4 { margin-top: $spacing-lg; }
.mt-5 { margin-top: $spacing-xl; }

.mb-1 { margin-bottom: $spacing-xs; }
.mb-2 { margin-bottom: $spacing-sm; }
.mb-3 { margin-bottom: $spacing-md; }
.mb-4 { margin-bottom: $spacing-lg; }
.mb-5 { margin-bottom: $spacing-xl; }

.p-1 { padding: $spacing-xs; }
.p-2 { padding: $spacing-sm; }
.p-3 { padding: $spacing-md; }
.p-4 { padding: $spacing-lg; }
.p-5 { padding: $spacing-xl; }

// 卡片样式
.card {
  background: $background-color-light;
  border-radius: $border-radius-xl;
  box-shadow: $box-shadow-card;
  border: 1px solid $border-color-light;
  transition: all $transition-base $ease-in-out;
  
  &:hover {
    box-shadow: $box-shadow-medium;
    transform: translateY(-2px);
  }
}

// 按钮样式
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: $spacing-sm $spacing-lg;
  border-radius: $border-radius-base;
  font-weight: $font-weight-medium;
  text-decoration: none;
  transition: all $transition-base $ease-in-out;
  cursor: pointer;
  border: none;
  outline: none;
  
  &-primary {
    background: $gradient-primary;
    color: white;
    
    &:hover {
      transform: translateY(-2px);
      box-shadow: $box-shadow-hover;
    }
  }
  
  &-secondary {
    background: $gradient-secondary;
    color: white;
    
    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 32px rgba(79, 172, 254, 0.15);
    }
  }
  
  &-outline {
    background: transparent;
    border: 2px solid $primary-color;
    color: $primary-color;
    
    &:hover {
      background: $primary-color;
      color: white;
      transform: translateY(-2px);
    }
  }
}

// 动画类
.fade-in {
  animation: fadeIn $transition-slow $ease-out;
}

.slide-up {
  animation: slideUp $transition-slow $ease-out;
}

.bounce-in {
  animation: bounceIn $transition-slow $ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

// 渐变背景
.gradient-bg {
  background: linear-gradient(135deg, $background-color-base 0%, $background-color-light 100%);
}

.gradient-primary {
  background: $gradient-primary;
}

.gradient-secondary {
  background: $gradient-secondary;
}

.gradient-accent {
  background: $gradient-accent;
}

// 响应式工具类
@media (max-width: $breakpoint-sm) {
  .hidden-sm {
    display: none !important;
  }
  
  .text-sm {
    font-size: $font-size-sm;
  }
}

@media (max-width: $breakpoint-md) {
  .hidden-md {
    display: none !important;
  }
  
  .text-md {
    font-size: $font-size-base;
  }
}

@media (max-width: $breakpoint-lg) {
  .hidden-lg {
    display: none !important;
  }
  
  .text-lg {
    font-size: $font-size-lg;
  }
}

// 加载动画
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid $border-color-light;
  border-radius: 50%;
  border-top-color: $primary-color;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

// 文本截断
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
} 